<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

    </style>
</head>
<body>
<div class="box">

</div>
<script>
    class Person{
        // 属性
        #n;
        age;
        get name(){
            return this.n;
        }
        set name(n){
            this.n =n;
        }
        // 实例方法
        eat(food){
            console.log(this.age+"岁的"+this.n+"用筷子吃"+food)
        }
        // 静态方法
        static sum(a,b){
            return a+b;
        }
        // 构造器
        constructor(name,age){
            this.n=name;
            this.age = age;
        }
    }
    var person = new Person();
    person.name="张三";
    person.age=18;
    person.eat("苹果");
    console.log(Person.sum(1,2));
    console.log(person.name);
    person.eat("香蕉")
    console.log(person.sum(1,2))
    class  Student extends Person{

    }
</script>
</body>
</html>